package com.boil.qz.safekavass.pojo;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by ChenYong on 2017-08-02.
 * <br>
 * zTree 简单数据映射实体类。
 */
public class ZTreeSimpleDataVo {
    /**
     * 编号
     */
    private Long id;
    /**
     * 父编号
     */
    private Long parentId;
    /**
     * 名称
     */
    private String name;
    /**
     * URL
     */
    private String url;
    /**
     * 展开/折叠 状态：true-展开；false-折叠
     */
    private boolean open;
    /**
     * 是否勾选：true-勾选；false-不勾选
     */
    private boolean checked;
    /**
     * 用于保存节点的其他自定义数据信息，不要与 zTree 使用的属性相同即可，用户可随意设定
     */
    private Map<String, Object> data;

    // 普通初始化块
    {
        data = new HashMap<String, Object>();
    }

    /**
     * 默认构造器。
     */
    public ZTreeSimpleDataVo() {
        super();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ZTreeSimpleDataVo that = (ZTreeSimpleDataVo) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        return parentId != null ? parentId.equals(that.parentId) : that.parentId == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("ZTreeSimpleDataVo{");
        sb.append("id=").append(id);
        sb.append(", parentId=").append(parentId);
        sb.append(", name='").append(name).append('\'');
        sb.append(", url='").append(url).append('\'');
        sb.append(", open=").append(open);
        sb.append(", checked=").append(checked);
        sb.append(", data=").append(data);
        sb.append('}');
        return sb.toString();
    }
}